import { DataTypes } from "sequelize";
import sequelize from "./db";

const UserModel = sequelize.define("users", {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    unique: true,
    allowNull: false,
    autoIncrement: true, // 自增长
  },
  email: {
    type: DataTypes.STRING(50),
    unique: true,
    allowNull: false,
  },
  password: {
    type: DataTypes.STRING(40),
    allowNull: false,
  },
  nickname: {
    type: DataTypes.STRING(30),
    allowNull: false,
  },
  ext_data: {
    type: DataTypes.TEXT,
    allowNull: true,
    defaultValue: ""
  }
})

export default UserModel
